In this topic you will find an introduction to the Tiny Hexer Script language.
|
|
Tiny Hexer Script is an interpreted programming language to add scripting capabilities to Tiny Hexer. Scripts are stored in text files having the file extension .mps. Each script consists of a sequence of commands separated by line feeds and/or colons (":"). Commands and functions are case insensitive. Comments ca be stored in a script file using the equal sign ("="). The language has conditional (IF...[ELSE...]ENDIF, REPEAT...UNTIL, WHILE...ENDWHILE) and unconditional flow control commands (CALL, GOTO and LOOP). Data can be stored in variables of various data types (TEXT, CHAR, BYTE, WORD, DWORD, QWORD, FILE and VARREF).
A simple Tiny Hexer Script might look like the following (without line numbers):
1) = Sample Script 2) VAR txt TEXT 3) @@LOOP_1 4) LET txt = INPUT("Input Query", "Please enter some text (no text to exit)", txt) 5) IF txt == "":END:ENDIF 6) MSGBOX ("You entered:\r\n"+txt), 0x40 7) GOTO LOOP_1
Description
Line 1): The equal sign ("=") tells Tiny Hexer to ignore
the rest of this line (used to store comments in the script file).
Line 2): The variable txt of data type TEXT is
defined (all variables must be defined in Tiny Hexer Script before using
them).
Line 3): The label LOOP_1 is defined. Labels are used to
name subroutines (CALL and LOOP commands) and targets for the GOTO
command.
Line 4): The result of the function INPUT(...) is assigned
to the variable txt.
Line 5): This line consists of three commands, separated by colons.
The first command (IF) checks if the condition (txt ==
"") is met. If yes, the following command is executed. If
not, the script continues at the command after the ENDIF command.
The second command (END) tells Tiny Hexer to stop execution of the
script. The third command (ENDIF) terminates the IF
block.
Line 6): The MSGBOX command is executed to show a message to
the user (the text he entered in this case).
Line 7): The GOTO command tells Tiny Hexer to continue
script execution at label LOOP_1.
|